<%-- 
    Document   : PayList
    Created on : 2012-12-8, 8:38:58
    Author     : Timmy
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="<c:url value='/css/main.css'/>" rel="stylesheet" type="text/css"/>
        <link href="<c:url value='/css/tablecss.css'/>" rel="stylesheet" type="text/css"/>
        <link href="<c:url value="/css/jquery-ui-1.9.2.custom.min.css" />" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="<c:url value="/scripts/jquery.js" />" ></script>
        <script type="text/javascript" src="<c:url value="/scripts/jquery-ui-1.9.2.custom.min.js" />" ></script>
        <script type="text/javascript">
            function updateStatus(userName,usertype,paytype,newstatus)
            {
                $("#PayUserName").val(userName);
                $("#PayName").val(usertype);
                if (paytype == "Conference")
                {
                    $("#PayType").val(1);
                }
                else {
                        $("#PayType").val(2);
                    }
                
                $("#PayStatus").val(newstatus);
                $("#hiddenForm").submit();
            }
        </script>
    </head>
    <body>
        <h1>Payment List for Conference <s:property value="conferenceName" /></h1>
        <table class="borderAll">
             <tr>
                <th>User Name</th>
                <th>Pay Name</th>
                <th>Pay Type</th>
                <th>Amount</th>
                <th>Pay Date</th>
                <th>Status</th>
                <th>Process By</th>
                <th>Process When </th>
                <th>Change Status</th>
            </tr>
        <s:iterator value="paymentModels">
            <tr class="<s:if test="#stat.odd == true">odd</s:if><s:else>even</s:else>">
                <td><s:property value="userName" /></td>
                <td><s:property value="payName" /></td>
                <td><s:property value="payType" /></td>
                <td><s:property value="amount" /></td>
                <td><s:property value="payDate" /></td>
                <td><s:property value="payStatus" /></td>
                <td><s:property value="approver" /></td>
                <td><s:property value="approveDate" /></td>
                <td>
                    <a href="javascript:updateStatus('<s:property value="userName" />','<s:property value="payName" />','<s:property value="payType" />','2');">Approve</a>
                    <a href="javascript:updateStatus('<s:property value="userName" />','<s:property value="payName" />','<s:property value="payType" />','0');">Reject</a>
                </td>
            </tr>
        </s:iterator>
         </table>
        
        <s:form method="post" action="ChangeStatus_%{conferenceName}" id="hiddenForm" >
            <input type="hidden" name="PayUserName" id="PayUserName" value="" />
            <input type="hidden" name="PayName" id="PayName" value="" />
            <input type="hidden" name="PayType" id="PayType" value="" />
            <input type="hidden" name="PayStatus" id="PayStatus" value="" />
        </s:form> 
    </body>
</html>
